package io.github.veigara.tcp.device.event.charger;

import com.google.common.eventbus.Subscribe;
import io.github.veigara.tcp.framework.event.DeviceEvent;
import io.github.veigara.tcp.framework.model.DeviceType;
import org.springframework.stereotype.Component;

/**
 * 充电机事件监听器
 */
@Component
public class ChargingPileEventListener {

    @Subscribe
    public void handleChargingPileEvent(DeviceEvent event) {
        if (event.getDeviceType() == DeviceType.CHARGING_PILE) {
            switch (event.getEventType()) {
                case STATUS_CHANGED:
                    handleStatusChanged(event);
                    break;
                case ALARM:
                    handleAlarm(event);
                    break;
            }
        }
    }

    private void handleStatusChanged(DeviceEvent event) {
        // 处理充电机状态变更
    }

    private void handleAlarm(DeviceEvent event) {
        // 处理充电机告警
    }
}
